﻿using System;
using ControleRepresentante.Data.Catalogs;
using ControleRepresentante.Logic.Models;
using ControleRepresentante.Logic.Repositories;
using FluentNHibernate.Cfg.Db;
using NHibernate.Cfg;

namespace ControleRepresentante.UnitTests.Mocks
{
    abstract class MockRepositoryProviderConfigurationBase : IRepositoryProviderConfiguration
    {
        private readonly MockSessionConfiguration m_SessionConfiguration;

        protected MockRepositoryProviderConfigurationBase(MockSessionConfiguration sessionConfiguration)
        {
            m_SessionConfiguration = sessionConfiguration;
        }

        public UserInfo GetUserInfo()
        {
            return m_SessionConfiguration.GetValue<UserInfo>(null, "UserInfo");
        }

        public Guid? GetRepresentanteId()
        {
            return m_SessionConfiguration.GetValue<Guid?>(null, "RepresentanteId");
        }

        public abstract IPersistenceConfigurer PersistenceConfigurerGenerator(ICatalog catalog);
        public abstract void ExposeConfiguration(Configuration configuration);
    }
}